import apis from '../../http/apis/apis'
export default {
    namespaced: true,
    state: {
        usersData: []
    },
    mutations: {
        getUsersData(state, data) {
            state.usersData = data
        }

    },
    actions: {
        async addUsers(context, result) {
            let data = apis.users.addUsers(result);
            return data
        },
        //查看我负责的所有客户
        async getUsers(context, result) {
            let data = await apis.users.getUsers({ salespersonsId: result });
            if (data.code) {
                context.commit('getUsersData', data.data);
            }
            console.log(data);
        },
        //修改客户信息
        async updateUsers(context, result) {
            let data = await apis.users.updateUsers(result)
            return data
        },
        //删除客户信息
        async deleteUsers(context, result) {
            let data = await apis.users.deleteUsers({ _id: result });
            return data
        }

    },
}